home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / nihcl-30.lha / nihcl-3.0 / errfac / ErrFac.h < prev    next >
C/C++ Source or Header  |  1990-05-15  |  2KB  |  75 lines

  1. #ifndef ERRFACH
  2. #define ERRFACH
  3.  
  4. // $Header: /afs/alw.nih.gov/unix/sun4_40c/usr/local/src/nihcl-3.0/share/errfac/RCS/ErrFac.h,v 3.0 90/05/15 22:36:52 kgorlen Rel $
  5.  
  6. /* ErrFac.h -- header file for Class ErrorFacility
  7.  
  8.     THIS SOFTWARE FITS THE DESCRIPTION IN THE U.S. COPYRIGHT ACT OF A
  9.     "UNITED STATES GOVERNMENT WORK".  IT WAS WRITTEN AS A PART OF THE
  10.     AUTHOR'S OFFICIAL DUTIES AS A GOVERNMENT EMPLOYEE.  THIS MEANS IT
  11.     CANNOT BE COPYRIGHTED.  THIS SOFTWARE IS FREELY AVAILABLE TO THE
  12.     PUBLIC FOR USE WITHOUT A COPYRIGHT NOTICE, AND THERE ARE NO
  13.     RESTRICTIONS ON ITS USE, NOW OR SUBSEQUENTLY.
  14.  
  15. Author:
  16.     S.M. Orlow
  17.     Systex,Inc.
  18.     Beltsville, MD 20705
  19.     301-474-0111
  20.     June, 1986
  21.  
  22. Contractor:
  23.     K. E. Gorlen
  24.     Bg. 12A, Rm. 2017
  25.     Computer Systems Laboratory
  26.     Division of Computer Research and Technology
  27.     National Institutes of Health
  28.     Bethesda, Maryland 20892
  29.     Phone: (301) 496-5363
  30.     uucp: uunet!nih-csl!kgorlen
  31.     Internet: kgorlen@alw.nih.gov
  32.  
  33. $Log:    ErrFac.h,v $
  34.  * Revision 3.0  90/05/15  22:36:52  kgorlen
  35.  * Release for 1st edition.
  36.  * 
  37. */
  38.  
  39. #include "errors.h"
  40.  
  41. class ErrorSpecs {
  42. public:
  43.     int severity;        /* severity of this error */
  44.     char* args;        /* error msg args: I=int, S=string,D=double */
  45.     char* text;        /* printf format string for error text */
  46.  
  47.     ErrorSpecs(int err_sev,char* err_args,char* err_text);
  48.     void printOn(ostream&);    
  49.     };
  50.  
  51. typedef ErrorSpecs* ErrorSpecsPt;
  52.  
  53. class ErrorFacility {
  54.     int Code;        // facility code 
  55.     char* shortname;    // facility short name for prefixing 
  56.     char* basename;        // facility basename for source files
  57.     char* longname;        // facility long name for the error msgs 
  58.     ErrorSpecsPt* errlist;    // all errors for this facility 
  59.     int last;        // last error in this facility
  60.     int capacity;        // no. of errors in facility 
  61.     int size;        // current size of error list 
  62.     void resize(int newcapacity);
  63. public:
  64.     ErrorFacility(char* long_name,char* short_name,
  65.             int fac_code,char* base_name);
  66.     void add(ErrorSpecs&);
  67.     void h_init(ostream&);
  68.     void h_define(ostream&,char*,int);
  69.     void h_finish(ostream&);
  70.     int lastError()        { return last; }
  71.     int code()        { return Code; }
  72.     void printOn(ostream&);
  73.     };
  74. #endif /* ERRFACH */
  75.